package com.xlh.enums.courseTest;

import com.google.common.collect.Maps;
import lombok.Getter;

import java.util.Map;

/**
 * @author zhr 2019/2/14
 */
@Getter
public enum QuestionOriginEnum {
    CUSTOM(0, "自定义"),
    PRESET(1, "系统预制");

    private final Integer code;
    private final String message;

    QuestionOriginEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    private static Map<Integer, QuestionOriginEnum> codeLookup = Maps.newHashMap();

    static {
        for (QuestionOriginEnum codeEnum : QuestionOriginEnum.values()) {
            codeLookup.put(codeEnum.getCode() , codeEnum);
        }
    }

    public static QuestionOriginEnum forCode(Integer code) {
        return codeLookup.get(code);
    }
}
